import rxAjax from '@/assets/ajax.js';
export const GatewayApi = {};
//获取门户列表
GatewayApi.listMobilePortals = function (appId) {
    var url= "/api-portal/portal/core/insPortalDef/listMobilePortals";
    if(appId){
        url+="?appId="+appId;
    }
    return rxAjax.postJson(url);
}
GatewayApi.listNews = function (parameter){
    let url= "/api-portal/portal/core/insNews/query";
    return rxAjax.postJson(url,parameter).then (res => {
        return res.result
    })
}
//获取待办数量
GatewayApi.getMyTaskCount = function(){
    var url= "/api-bpm/bpm/core/bpmTask/getMyTaskCount";
    return rxAjax.get(url).then(res=>{
        return res.data;
    })
}
//获取app应用里面的栏目
GatewayApi.updateProcessStatus=function(instId,status) {
    let params={
        instId:instId,
        status:status
    }
    var url= "/api-bpm/bpm/core/bpmInst/updateProcessStatus";
    return rxAjax.postForm(url,params).then (res => {
        return res
    });
}
GatewayApi.cancelProcess=function(params) {
    let url= "/api-bpm/bpm/core/bpmInst/cancelProcess"
    return rxAjax.postForm(url,params).then (res => {
        return res
    });
}
GatewayApi.bpmInstDel=function(instId) {
    let params ={
        ids:instId
    }
    let url= "/api-bpm/bpm/core/bpmInst/del";
    return rxAjax.postForm(url,params).then (res => {
        return res
    });
}
GatewayApi.removeTracked=function(instId) {
    let params={instId:instId};
    let url= "/api-bpm/bpm/core/bpmInstTracked/removeTracked";
    return rxAjax.postForm(url,params).then (res => {
        return res
    });
}

//删除我的异步
GatewayApi.bpmAsyncTaskDel=function(ids){
    let params = {ids: ids};
    var url= "/api-bpm/bpm/core/bpmAsyncTask/del";
    return rxAjax.postForm(url,params).then (res => {
        return res
    });
}
//异步详情/api-bpm/bpm/core/bpmAsyncTask/get?
GatewayApi.bpmAsyncTaskGet=function(pkId) {
    var url= '/api-bpm/bpm/core/bpmAsyncTask/get?pkId='+pkId;
    return rxAjax.get(url).then (res => {
        return res
    });
}
//消息变成已读
GatewayApi.readMessage =function(params) {
    var url=  '/api-portal/portal/core/infInnerMsg/readMessage';
    return rxAjax.postJson(url,params).then (res => {
        return res
    });
}
GatewayApi.getFindAuthButton= function() {
    let url= '/api-user/user/org/osUser/findAuthButton';
    return rxAjax.get(url).then (res => {
        return res
    });
}
GatewayApi.getByAppKey= function(appKey) {
    let url= '/api-system/system/core/sysApp/getByAppKey?appKey='+appKey;
    return rxAjax.get(url).then (res => {
        return res
    });
}
export default GatewayApi
